/**
 * This project create for studying propose at BUPT University. You can change or reuse this project anywhere
 */

package edu.bupt.ooad.library.ui;

import java.util.ArrayList;
import java.util.List;

import edu.bupt.ooad.library.Book;
import edu.bupt.ooad.library.BookDescription;
import edu.bupt.ooad.library.Borrow;
import edu.bupt.ooad.library.Patron;

/**
 * @author Hamed Abdollahpour
 */
public class Tools {

    public static List<Book> listAllBooks(List<BookDescription> descriptions) {
        List<Book> results = new ArrayList<Book>();

        for (BookDescription description : descriptions) {
            for (Book book : description.getBooks()) {
                results.add(book);
            }
        }

        return results;
    }

    public static List<Borrow> listBorrows(List<Patron> patrons) {
        List<Borrow> results = new ArrayList<Borrow>();

        for (Patron patron : patrons) {
            for (Borrow borrow : patron.getBorrows()) {
                results.add(borrow);
            }
        }

        return results;
    }

}
